home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / amos / pegitsrc.lha / Peg-It_src.AMOS / Peg-It_src.amosSourceCode < prev    next >
AMOS Source Code  |  1996-05-03  |  30KB  |  1,032 lines

  1. '              -----------------------------------------   
  2. '              |        Peg-It By Paul Burkey          |   
  3. '              |           Started 1-1-94              | 
  4. '              |         Demo compiled 3-5-96          | 
  5. '              |       (C) 1994 Daisy Software         | 
  6. '              ----------------------------------------- 
  7. '  
  8. ' This is a cut down version of the source for the Peg-It Demo!  
  9. ' It is cut down and some anotation is made to make it easier to 
  10. ' understand.  
  11. '
  12. ' To make the compiled game as small as possible some of the source
  13. ' code was made as tight as can be! meaning the use of goto's and  
  14. ' anything else that will make the code shorter. For example The last  
  15. ' Procedure Task[z]. This was used because it saved about 1k by reducing 
  16. ' the need for so many for : next loops. Don't let this confuse you there
  17. ' are a few places where the code is made as silly as can be! just because 
  18. ' it compiles shorter! 
  19. '
  20. ' email me at:- paulb@sneech.demon.co.uk   
  21. '
  22. ' The full version can be ordered from me for the price of ï¿½3 or the 
  23. ' nearest price in your currency. Add an extra ï¿½1 for countries outside
  24. ' europe........ 
  25. '
  26. ' Paul Burkey
  27. ' 32 Cottage Close 
  28. ' Little Neston
  29. ' South Wirral 
  30. ' L64 9RB  
  31. '
  32. ' The full version has 150 levels as well as a few other extras :) 
  33. '
  34. '
  35. Dim GRID(8,8),TBOB(8,8),_BOB(8,8),DREC(70),SPRINGS(4,2)
  36. '
  37. Global GRID(),TBOB(),_BOB(),DREC(),SPRINGS(),LEVEL,TXM,TYM,XX,TITLE,BLEEP
  38. Global ESC,TIME,LASTTIME,JUMPS,LASTJUMPS,LASTIN,IN,OK,PASS,LEVEL$,CODE$,B
  39. Global CHAN,SPRINGS,LANDX,LANDY,KEEPX,KEEPY,LASTLEVEL,SX,SY,_ENDIT,MES,C,AC
  40. '
  41. SETUP
  42. Unpack 12 To 1 : Screen Hide 1 : CHAN=1 : Hide On 
  43. '
  44. Do 
  45.    LA:
  46.    '  I wonder what this next line does???
  47.    LEVEL=1
  48.    MAINSCREEN
  49.    Do 
  50.       If LEVEL>50 Then End 
  51.       If _ENDIT Then PASS=0 : Exit 
  52.       LEVEL
  53.       MAIN
  54.    Loop 
  55. Loop 
  56. '
  57. '                                Setup-procs 
  58. Procedure SETUP
  59.    '
  60.    ' All the graphics are loaded and unpacked but in this version they are
  61.    ' already in memory!!! 
  62.    '
  63.    XX=71 : Rem  this is where the normal sprite bank ends and the font starts NEXT! 
  64.    '
  65. End Proc
  66. Procedure _TEX[X,Y,T$]
  67.    '
  68.    ' I always have my own TEXT command to allow me to use Sprites instead 
  69.    ' of using fonts. Notice theres no fonts in the whole game. Just Sprites 
  70.    '    
  71.    '
  72.    If PASS=2002 Then PASS=2 : Pop Proc : Rem not sure what this was for?
  73.    BBOB=0 : AC=0
  74.    For A=1 To Len(T$)
  75.       C=Asc(Mid$(T$,A,1))
  76.       If C=32
  77.          Add AC,6
  78.       Else 
  79.          MOV[1]
  80.          Add C,XX-54
  81.          Paste Bob X+AC,Y-12,C
  82.          MOV[0]
  83.       End If 
  84.    Next A
  85. End Proc
  86. Procedure MES[T$]
  87.    AC=0 : Rem same sort of thing as tex  
  88.    For A=1 To Len(T$)
  89.       C=Asc(Mid$(T$,A,1))
  90.       If C=32
  91.          Add AC,6
  92.       Else 
  93.          MOV[2]
  94.       End If 
  95.    Next A
  96.    MES=160-AC/2
  97. End Proc
  98. Procedure MOV[XXX]
  99.    ' this moves the next pos for the next letter
  100.    If XXX Then If C>47 and C<58 Then Add C,7 Else If C=46 Then C=65 Else If C=63 Then C=93 Else If C=33 Then C=66 Else Add C,-30
  101.    If XXX<>1 Then Add AC,9
  102. End Proc
  103. Procedure PAUSE[PAUSE]
  104.    Timer=0
  105.    Repeat 
  106.       Exit If Timer>PAUSE
  107.    Until Mouse Key
  108.    If Timer<PAUSE or Mouse Key Then PASS=2002
  109. End Proc
  110. Procedure LEVEL
  111.    ' this loads in the figures for the level Time, Jumps and map data!
  112.    Dec LEVEL
  113.    TASK[2]
  114.    TIME=Peek(Start(10)+LEVEL*100+59)
  115.    JUMPS=Peek(Start(10)+LEVEL*100+69)
  116.    '
  117.    LEVEL$=""
  118.    For A=0 To 9
  119.       B=Peek(Start(10)+LEVEL*100+A+90)
  120.       If B=0 Then B$=" " Else B$=Chr$(B)
  121.       LEVEL$=LEVEL$+B$
  122.    Next A
  123.    Repeat 
  124.       If Right$(LEVEL$,1)=" " Then LEVEL$=Left$(LEVEL$,Len(LEVEL$)-1)
  125.    Until Right$(LEVEL$,1)<>" "
  126.    Inc LEVEL
  127.    LEVELCODE[LEVEL] : Rem get the code for it just in case its needed! 
  128.    '  
  129.    '
  130. End Proc
  131. '                                Main-proc 
  132. Procedure MAIN
  133.    Unpack 12 To 0 : Screen Hide 0 : Fade 1 : Wait 17 : Double Buffer 
  134.    Limit Mouse 240,69 To 368,197
  135.    '
  136.    TASK[1]
  137.    '
  138.    LASTIN=-1 : LASTTIME=-1 : LASTJUMPS=-1
  139.    IN=0 : KEEPX=-1 : KEEPY=-1
  140.    '
  141.    SHO_FIGURES
  142.    Paste Bob 13,47,39
  143.    _TEX[8,21,"level"+Str$(LEVEL)]
  144.    _TEX[8,42,LEVEL$]
  145.    Sprite Off 
  146.    '                      Quick start 
  147.    '
  148.    If LASTLEVEL=LEVEL Then SHO : PLACE : Sprite 9,SX*16+240,SY*16+69,37
  149.    '
  150.    LASTTIME=-1 : SHO_FIGURES
  151.    '
  152.    Screen Show 0 : Shift Down 2,27,29,1
  153.    Fade 8 To 1
  154.    For A=46 To 2 Step -4 : Volume CHAN,A : Sam Play CHAN,5,5000 : CHAN : Wait 6 : Next A
  155.    Wait 5 : Volume %1111,63
  156.    '
  157.    If LASTLEVEL<>LEVEL Then SHO
  158.    '
  159.    JINGLE : Wait Vbl 
  160.    '
  161.    ' Some people hate the Amal language but it can be the best method 
  162.    ' for some things. here it moves the sprite or pointer using the mouse 
  163.    '
  164.    Sprite 8,X Mouse,Y Mouse,37
  165.    Channel 1 To Sprite 8
  166.    Wait Vbl : Amal 1,"G: L X=XM;L Y=YM;J G" : Amal On 1
  167.    '
  168.    Timer=0
  169.    X=SX : Y=SY : TXM=SX : TYM=SY
  170.    '
  171.    '
  172.    '   This is the main Procedure where it all starts!!!! 
  173.    '
  174.    Do 
  175.       ESC=0 : _DOMAN[X,Y]
  176.       If IN<2 Then FINESHED : Exit 
  177.       If TIME=0 or JUMPS=0 Then OUTA : Exit 
  178.       If ESC or Key State(69) Then Exit 
  179.       If Key State(95) Then Exit 
  180.       X=Min(8,Max(0,(X Mouse-233)/16)) : Y=Min(8,Max(0,(Y Mouse-62)/16))
  181.       If _BOB(X,Y)>0 Then CANMOVE[X,Y,1] : If OK Then Goto JID Else If KEEPX+KEEPY>0 Then X=KEEPX : Y=KEEPY : Goto JID
  182.       If _BOB(X,Y)=0 Then Sam Play %11,5,25000 : Repeat : Until Mouse Key=0 : If KEEPX+KEEPY>0 Then X=KEEPX : Y=KEEPY
  183.       JID:
  184.    Loop 
  185.    '
  186.    '
  187.    '
  188. End Proc
  189. Procedure _DOMAN[XM,YM]
  190.    '
  191.    ' A peg-it has been clicked on! now lets see if he can go anywhere!
  192.    '
  193.    MAN=_BOB(XM,YM)
  194.    CANMOVE[XM,YM,1]
  195.    '                That was easy, if he can't then ga back to main!
  196.    If OK=0 Then Pop Proc
  197.    '
  198.    '   Now a valid peg-it has been chosen and is selected 
  199.    '   In this loop you could select another, Jump or NOT jump? 
  200.    '
  201.    Do 
  202.       CANMOVE[XM,YM,0] : If OK=0 Then PLACE : YM=SY : XM=SX
  203.       Sprite 9,XM*16+240,YM*16+69,37
  204.       If TXM<>XM or TYM<>YM Then Sam Play %11,3,20000 : Repeat : SHO_FIGURES : Until Mouse Key=0 : TXM=XM : TYM=YM
  205.       Do 
  206.          SHO_FIGURES
  207.          X=Min(8,Max(0,(X Mouse-233)/16)) : Y=Min(8,Max(0,(Y Mouse-62)/16))
  208.          POS=-1 : MOX=0 : MOY=0
  209.          '
  210.          ' We now know where you are pointing now lets see if it is valid by
  211.          ' following the path!  
  212.          '
  213.          If X=XM and Y=YM-2 Then FOLOW[XM,YM,0,-1,0] : If PASS Then POS=0 : MOX=0 : MOY=-2
  214.          If Y=YM and X=XM+2 Then FOLOW[XM,YM,1,0,1] : If PASS Then POS=1 : MOX=2 : MOY=0
  215.          If X=XM and Y=YM+2 Then FOLOW[XM,YM,0,1,2] : If PASS Then POS=2 : MOX=0 : MOY=2
  216.          If Y=YM and X=XM-2 Then FOLOW[XM,YM,-1,0,3] : If PASS Then POS=3 : MOX=-2 : MOY=0
  217.          '
  218.          ' if its valid then face that direction
  219.          '
  220.          If POS>-1 Then If POS<>DREC(MAN) Then FACE[MAN,POS]
  221.          If Key State(69) Then Inc ESC : Exit 2
  222.          If Key State(95) Then Inc LEVEL : Inc ESC : Exit 2
  223.          If TIME=0 or JUMPS=0 or IN<2 Then Exit 2
  224.          '
  225.          ' This is a bit tricky but if you are clicking in the right place
  226.          ' it will now jump for you!
  227.          '
  228.          If Mouse Key>0 Then If POS=-1 Then PASS=1 : KEEPX=XM : KEEPY=YM : Exit 2 Else Dec JUMPS : Repeat : Gosub DREC : JUMP[XM,YM,MOX,MOY,POS] : XM=LANDX : YM=LANDY : MAN=_BOB(XM,YM) : TXM=XM : TYM=YM : Until PASS=0 : Exit 
  229.       Loop 
  230.    Loop 
  231.    Pop Proc
  232.    '
  233.    DREC:
  234.    If GRID(XM,YM)=4 Then POS=0 : MOX=0 : MOY=-2
  235.    If GRID(XM,YM)=5 Then POS=1 : MOX=2 : MOY=0
  236.    If GRID(XM,YM)=6 Then POS=2 : MOX=0 : MOY=2
  237.    If GRID(XM,YM)=7 Then POS=3 : MOX=-2 : MOY=0
  238.    If XM<8 Then If GRID(XM,YM)=50 and _BOB(XM+1,YM) Then POS=1 : MOX=2 : MOY=0
  239.    If XM>0 Then If GRID(XM,YM)=51 and _BOB(XM-1,YM) Then POS=3 : MOX=-2 : MOY=0
  240.    Return 
  241.    '
  242. End Proc
  243. '                                Other-screens 
  244. Procedure MAINSCREEN
  245.    '
  246.    ' main title screen
  247.    '
  248.    TITLE=1
  249.    Gosub SETUP
  250.    LASTLEVEL=-1
  251.    '
  252.    T=0 : Timer=0
  253.    Shift Down 2,27,29,1
  254.    PASS=0
  255.    Do 
  256.       If Timer>13 Then If T=0 Then Sam Play %10,6,20000 : Inc T
  257.       If Timer>26 Then Sam Play %1,5,15000 : Timer=0 : Dec T
  258.       If Mouse Key=1
  259.          ZZZ=X Mouse
  260.          BLOOP
  261.          Fade 1
  262.          Wait 17
  263.          If ZZZ<287
  264.             Repeat : Gosub NEWGAME : Until PASS=1 : PASS=0
  265.          Else 
  266.             PASS=1
  267.          End If 
  268.          _ENDIT=0
  269.          Exit 
  270.       End If 
  271.       Gosub DAISY
  272.       Wait Vbl 
  273.    Loop 
  274.    Pop Proc
  275.    '
  276.    '    --------------------- new game -------------
  277.    '
  278.    NEWGAME:
  279.    TITLE=2
  280.    Gosub SETUP
  281.    '
  282.    PASS=0
  283.    Do 
  284.       If Mouse Key=1
  285.          If X Mouse<287
  286.             ' Gosub _GETCODE : I took the code out for this  
  287.          Else 
  288.             PASS=1
  289.             BLOOP
  290.          End If 
  291.          Exit 
  292.       End If 
  293.       Gosub DAISY
  294.       Wait Vbl 
  295.    Loop 
  296.    Fade 1
  297.    Wait 17
  298.    Return 
  299.    '
  300.    '
  301.    SETUP:
  302.    FRESHSCREEN[1]
  303.    For B=0 To 5
  304.       Ink 8+B
  305.       Box 40-B,135-B To 145+B,160+B
  306.       Box 175-B,135-B To 280+B,160+B
  307.    Next B
  308.    Limit Mouse 170,177 To 405,197
  309.    Screen Show 0
  310.    Fade 12 To 1
  311.    Return 
  312.    '
  313.    DAISY:
  314.    If Rnd(50) Then Goto EN
  315.    Add B,1,6 To 12
  316.    X=Rnd(2) : Y=43 : If X=1 Then Y=65
  317.    Bob B-5,37+X*112,Y,47
  318.    Channel B To Bob B-5
  319.    Move Y B,"(1,-3,6)(1,-2,6)(1,-1,6)(1,0,6)(1,1,6)(1,2,6)(1,3,6)(1,4,6)(1,5,7)(1,6,7)(1,7,7)(1,8,7)(1,9,7)"
  320.    Z=Rnd(3)
  321.    If Z=0 Then Move X B,"(1,-5,12)(1,-4,12)(1,-2,16)(1,-1,99)" Else If Z=1 Then Move X B,"(1,5,12)(1,4,12)(1,2,16)(1,1,99)" Else If Z=2 Then Move X B,"(1,-4,10)(1,-2,16)(1,-1,99)" Else Move X B,"(1,4,10)(1,2,16)(1,1,99)"
  322.    Move On B
  323.    CHAN : Sam Play CHAN,1,9000+Rnd(9000)
  324.    EN:
  325.    Return 
  326.    '
  327. End Proc
  328. Procedure FRESHSCREEN[PAZ]
  329.    '
  330.    ' procedure to open various screens. It is made complicated to save
  331.    ' space. Sorry about that... 
  332.    '
  333.    Unpack 12 To 0 : Screen Hide 0 : Fade 1 : Wait 17
  334.    Sprite Off 
  335.    Cls 10,5,5 To 314,194
  336.    Screen Copy 0,20,0,140,199 To 0,140,0
  337.    For A=10 To 170 Step 10
  338.       Screen Copy 0,0,A,319,A+10 To 0,0,A+10
  339.    Next A
  340.    If PAZ
  341.       Paste Bob 12,20,39
  342.       Paste Bob 126,42,39
  343.       Paste Bob 242,20,39
  344.       _TEX[35,188,"copyright 1994 daisy software"]
  345.       Sprite 8,X Mouse,Y Mouse,42
  346.       Channel 1 To Sprite 8 : Amal 1,"G: L X=XM;L Y=YM;J G" : Amal On 1
  347.       If TITLE=1
  348.          _TEX[85,25,"peg it quick blast"]
  349.          _TEX[100,40,"by paul burkey"]
  350.          _TEX[48,155,"play peg it"]
  351.          _TEX[179,155,"play peg it"]
  352.       Else 
  353.          LEVEL
  354.          _TEX[105,25,"ready to play"]
  355.          A$="level"+Str$(LEVEL)+". "+LEVEL$
  356.          MES[A$] : _TEX[MES,40,A$]
  357.          _TEX[45,155,"     "]
  358.          _TEX[210,155,"play"]
  359.       End If 
  360.       Double Buffer 
  361.    Else 
  362.       Paste Bob 10,8,39
  363.       Paste Bob 10,114,39
  364.       Paste Bob 242,8,39
  365.       Paste Bob 242,114,39
  366.    End If 
  367.    Limit Mouse 
  368. End Proc
  369. Procedure SHO
  370.    '
  371.    B=10
  372.    '
  373.    ' This is the most complicated bit. It used the data bank 10 the get 
  374.    ' place the bits on the board. It also updated the grid(x,y), that 
  375.    ' stores the positions of the parts on the screen. ie. trapolines! 
  376.    ' and _bob(x,y) tels you which bob is used for which place 
  377.    '
  378.    '
  379.    '
  380.    If LASTLEVEL=LEVEL Then Gosub QUICK : Pop Proc
  381.    '
  382.    For SC=1 To 69
  383.       X=-1 : Y=-1
  384.       For AA=0 To 8
  385.          For BB=0 To 8
  386.             GRID=0
  387.             If GRID(AA,BB)=51 Then GRID=1 Else If GRID(AA,BB)<>50 Then GRID=GRID(AA,BB)
  388.             If Peek(Start(13)+81+BB*9+AA)=SC and GRID>0 Then X=AA : Y=BB
  389.          Next BB
  390.       Next AA
  391.       If X=-1 and Y=-1 Then Goto NOBOB
  392.       TITLE=0 : Gosub THINGS
  393.       '
  394.       ' old = 10000) : Wait 3 : Goto 
  395.       '  
  396.       If PASS Then Goto NOBOB
  397.       Channel 15 To Bob B
  398.       DREC(B)=-1
  399.       ZZ=Peek(Start(13)+Y*9+X)
  400.       If ZZ=1
  401.          Bob B,182,20,19 : OX=4 : OY=0 : MOVE[B,0,1,2]
  402.       Else 
  403.          If ZZ=2
  404.             Bob B,262,99,28 : OX=8 : OY=4 : MOVE[B,-1,0,3]
  405.          Else 
  406.             If ZZ=3
  407.                Bob B,182,179,1 : OX=4 : OY=8 : MOVE[B,0,-1,0]
  408.             Else 
  409.                Bob B,102,99,10 : OX=0 : OY=4 : MOVE[B,1,0,1]
  410.             End If 
  411.          End If 
  412.       End If 
  413.       '
  414.       Repeat 
  415.          A: If OY<Y Then If _BOB(OX,OY+1)=0 and GRID(OX,OY+1)<99 Then Inc OY : MOVE[B,0,1,2] : Goto A
  416.          B: If OX>X Then If _BOB(OX-1,OY)=0 and GRID(OX-1,OY)<99 Then Dec OX : MOVE[B,-1,0,3] : Goto B
  417.          C: If OY>Y Then If _BOB(OX,OY-1)=0 and GRID(OX,OY-1)<99 Then Dec OY : MOVE[B,0,-1,0] : Goto C
  418.          D: If OX<X Then If _BOB(OX+1,OY)=0 and GRID(OX+1,OY)<99 Then Inc OX : MOVE[B,1,0,1] : Goto D
  419.       Until OX=X and OY=Y
  420.       Anim Off 15
  421.       FACE[B,0]
  422.       _BOB(X,Y)=B : GRID(X,Y)=GRID(X,Y)-1
  423.       Inc B
  424.       Inc IN : Timer=0 : SHO_FIGURES
  425.       NOBOB:
  426.    Next SC
  427.    '
  428.    BLEEP=1 : Gosub FINGS
  429.    Gosub SPRINGS
  430.    PLACE
  431.    LASTLEVEL=LEVEL
  432.    Pop Proc
  433.    '
  434.    FINGS:
  435.    For X=0 To 8
  436.       For Y=0 To 8
  437.          TITLE=1 : Gosub THINGS
  438.          If PASS and BLEEP Then Sam Play %1,3,25000
  439.       Next Y
  440.    Next X
  441.    Return 
  442.    '
  443.    QUICK:
  444.    For X=0 To 8
  445.       For Y=0 To 8
  446.          If GRID(X,Y)>49 and GRID(X,Y)<99 Then GRID=GRID(X,Y)-50 Else GRID=GRID(X,Y)
  447.          If GRID=1
  448.             Bob B,118+X*16,35+Y*16,1
  449.             _BOB(X,Y)=B : DREC(B)=0
  450.             Inc B : Inc IN
  451.             GRID(X,Y)=GRID(X,Y)-1
  452.          End If 
  453.          TITLE=1 : Gosub THINGS
  454.       Next Y
  455.    Next X
  456.    BLEEP=0 : Gosub FINGS
  457.    Gosub SPRINGS
  458.    Return 
  459.    '
  460.    THINGS:
  461.    PASS=0
  462.    GR=GRID(X,Y)
  463.    If GR=13 or GR=22 or GR=23
  464.       If TITLE
  465.          Paste Bob 111+X*16,26+Y*16,46+GR
  466.       End If 
  467.       Inc PASS : Return 
  468.    End If 
  469.    If GR=14 or GR=20 or GR=21
  470.       If TITLE
  471.          Paste Bob 110+X*16,28+Y*16,46+GR
  472.       End If 
  473.       Inc PASS : Return 
  474.    End If 
  475.    If PASS=0 and GR>1 and GR<30
  476.       If TITLE
  477.          Paste Bob 112+X*16,29+Y*16,46+GR
  478.       End If 
  479.       Inc PASS
  480.    End If 
  481.    Return 
  482.    '
  483.    SPRINGS:
  484.    SPRINGS=0
  485.    For Y=0 To 8
  486.       For X=0 To 7
  487.          If GRID(X,Y)=50
  488.             GRID(X+1,Y)=51
  489.             If _BOB(X,Y)
  490.                SHAPE=0
  491.             Else 
  492.                SHAPE=1
  493.             End If 
  494.             Bob 5+SPRINGS,126+X*16,35+Y*16,43+SHAPE*2
  495.             SPRINGS(SPRINGS,0)=X
  496.             SPRINGS(SPRINGS,1)=Y
  497.             SPRINGS(SPRINGS,2)=SHAPE
  498.             If LASTLEVEL<>LEVEL
  499.                Sam Play %11,7,6000
  500.                Wait 20
  501.             End If 
  502.             Inc SPRINGS
  503.          End If 
  504.       Next X
  505.    Next Y
  506.    Return 
  507. End Proc
  508. '                                Game-Procs
  509. Procedure FOLOW[X,Y,MX,MY,DREC]
  510.    '
  511.    ' This is one of the most important procedures it will, when given 
  512.    ' the start x,y and the direction speed ie x=2,y=0  oops can't remember
  513.    ' what DREC was for! sorry!
  514.    '
  515.    ' The original grid is saved in array Tgrid(x,y) and will be put back
  516.    ' when were done 
  517.    '
  518.    '
  519.    TASK[0]
  520.    TBOB(X,Y)=0
  521.    PASS=0
  522.    NX=X+MX*2
  523.    NY=Y+MY*2
  524.    '
  525.    ' Now we have worked out the next place to land is it valid. 
  526.    '
  527.    Do 
  528.       '
  529.       '            Land on things or over   : DON'T  
  530.       '
  531.       Exit If NX>8 or NX<0 or NY>8 or NY<0
  532.       LAND=GRID(NX,NY)
  533.       Exit If LAND=10
  534.       If MX<>0 Then If LAND=14 or GRID(X+MX,Y)=14 or GRID(X,Y)=14 Then Exit 
  535.       If MY<>0 Then If LAND=13 or GRID(X,Y+MY)=13 or GRID(X,Y)=13 Then Exit 
  536.       If MX>0 Then If LAND=20 or GRID(X+MX,Y)=20 or GRID(X+MX,Y)=21 Then Exit 
  537.       If MX<0 Then If LAND=21 or GRID(X+MX,Y)=21 or GRID(X+MX,Y)=20 Then Exit 
  538.       If MY>0 Then If LAND=22 or GRID(X,Y+MY)=22 or GRID(X,Y+MY)=23 Then Exit 
  539.       If MY<0 Then If LAND=23 or GRID(X,Y+MY)=23 or GRID(X,Y+MY)=22 Then Exit 
  540.       Exit If TBOB(NX,NY)>0 or LAND=2 or LAND=99
  541.       If GRID(X+MX,Y+MY)=2 Then If(GRID(X,Y)<>17 and GRID(X,Y)<>18) Then Exit 
  542.       If TBOB(X+MX,Y+MY)>0 Then If GRID(X+MX,Y+MY)=17 or GRID(X+MX,Y+MY)=18 Then If(GRID(X,Y)<>17 and GRID(X,Y)<>18) Then Exit 
  543.       '
  544.       If X+MX>0 and X+MX<9 Then If Y+MY>0 and Y+MY<9 Then TBOB(X+MX,Y+MY)=0 : Rem          jumped bob  
  545.       '
  546.       '           Land on floor or teletort : OK 
  547.       '
  548.       If TBOB(NX,NY)=0
  549.          If LAND=0 or LAND=9 or LAND=11 or LAND=12 or LAND=13 or LAND=14 or LAND=18 or LAND=17 or LAND=20 or LAND=21 or LAND=22 or LAND=23
  550.             PASS=1 : Exit 
  551.          End If 
  552.          If LAND=8 or LAND=15 or LAND=19
  553.             TELEPORT[NX,NY,0] : Exit 
  554.          End If 
  555.          If LAND=25
  556.             ARROW[NX,NY,0] : Exit 
  557.          End If 
  558.       End If 
  559.       '
  560.       If NX<8 Then If LAND=50 and TBOB(NX+1,NY)=0 Then PASS=1 : Exit 
  561.       If NX>0 Then If LAND=51 and TBOB(NX-1,NY)=0 Then PASS=1 : Exit 
  562.       '
  563.       '           Spring or Bounce          : CHECK FURTHER
  564.       '
  565.       If LAND=4 Then MX=0 : MY=-1
  566.       If LAND=5 Then MX=1 : MY=0
  567.       If LAND=6 Then MX=0 : MY=1
  568.       If LAND=7 Then MX=-1 : MY=0
  569.       If LAND=16 or LAND=24 Then SLIP[NX,NY,0] : NX=LANDX : NY=LANDY
  570.       '
  571.       Swap TBOB(X,Y),TBOB(NX,NY)
  572.       '
  573.       If NX<8 Then If LAND=50 and TBOB(NX+1,NY) Then Inc NX : MX=-1 : MY=0 : Goto SPR
  574.       If NX>0 Then If LAND=51 and TBOB(NX-1,NY) Then Dec NX : MX=1 : MY=0
  575.       SPR:
  576.       '
  577.       X=NX : NX=X+MX*2
  578.       Y=NY : NY=Y+MY*2
  579.       '
  580.       'this will loop over and over until a peg-it lands on a space etc. or
  581.       'it will exit if a peg-it would jump out of the arena INVALID
  582.       'if it does land on a trampoline ot a see'saw the new direction is 
  583.       'worked out and it will loop again!
  584.       '
  585.    Loop 
  586.    '
  587.    ' You can use the End Proc[?] command to return things from procedures 
  588.    ' but I am so used to returning PASS or OK or something that makes the 
  589.    ' program easier to follow as returning things is a bit stupid in AMOS!
  590.    ' In this procedure If I remember? it will return OK=1 if a valid jum was made 
  591.    '
  592. End Proc
  593. Procedure JUMP[X,Y,JX,JY,DREC]
  594. '
  595. ' This is the actual jumping bit. Same as the prev Proc except we already
  596. ' know that it's a valid move and it just goes along with the movements! 
  597. '
  598.    PASS=0
  599.    MAN=_BOB(X,Y)
  600.    MAN2=_BOB(X+JX/2,Y+JY/2)
  601.    LANDX=X+JX : LANDY=Y+JY
  602.    Swap _BOB(X,Y),_BOB(LANDX,LANDY)
  603.    If(GRID(X,Y)>2 and GRID(X,Y)<8) or GRID(X,Y)=16 or GRID(X,Y)=24 Then SPRING=1
  604.    If GRID(X,Y)=50 Then If _BOB(X+1,Y)>0 Then SPRING=1
  605.    If GRID(X,Y)=51 Then If _BOB(X-1,Y)>0 Then SPRING=1
  606.    If MAN2>0 Then _BOB(X+JX/2,Y+JY/2)=0
  607.    If(GRID(LANDX,LANDY)>2 and GRID(LANDX,LANDY)<8) or GRID(LANDX,LANDY)=16 or GRID(LANDX,LANDY)=24 Then LAND=1
  608.    If GRID(LANDX,LANDY)=50 Then If _BOB(LANDX+1,LANDY)>0 Then LAND=1
  609.    If GRID(LANDX,LANDY)=51 Then If _BOB(LANDX-1,LANDY)>0 Then LAND=1
  610.    '
  611.    Channel 15 To Bob MAN
  612.    '
  613.    '   spring takes 17.  No spring takes 28   
  614.    '
  615.    If SPRING
  616.       Anim 15,"("+Str$(1+DREC*9)+",3)("+Str$(3+DREC*9)+",4)("+Str$(4+DREC*9)+",5)("+Str$(3+DREC*9)+",4)("+Str$(1+DREC*9)+",1)"
  617.       XP$="(1,3,6)(1,2,4)(1,1,4)(1,0,1)(1,1,2)"
  618.       XM$="(1,-3,6)(1,-2,4)(1,-1,4)(1,0,1)(1,-1,2)"
  619.    Else 
  620.       Anim 15,"("+Str$(2+DREC*9)+",11)("+Str$(1+DREC*9)+",4)("+Str$(3+DREC*9)+",5)("+Str$(4+DREC*9)+",4)("+Str$(3+DREC*9)+",3)("+Str$(1+DREC*9)+",1)"
  621.       XP$="(1,0,11)(1,3,6)(1,2,4)(1,1,4)(1,0,1)(1,1,2)"
  622.       XM$="(1,0,11)(1,-3,6)(1,-2,4)(1,-1,4)(1,0,1)(1,-1,2)"
  623.    End If 
  624.    '
  625.    If DREC=0 Then Move Y 15,XM$ Else If DREC=1 Then Move X 15,XP$ Else If DREC=2 Then Move Y 15,XP$ Else Move X 15,XM$
  626.    '
  627.    Anim On 15 : Move On 15 : If(1-SPRING) Then Wait 11
  628.    Sam Play %1000,1,20000 : SHO_FIGURES
  629.    '
  630.    If MAN2
  631.       Wait 1 : Bob MAN2,,,40 : Wait 3 : Bob MAN2,,,41 : Wait 4
  632.       Sam Play %1100,2,10000 : Bob MAN2,,,42 : Wait 4
  633.       Sam Play %11,2,20000 : Bob Off MAN2 : Wait 5
  634.       Dec IN : SHO_FIGURES
  635.    Else 
  636.       Wait 17
  637.    End If 
  638.    '
  639.    LANDON=GRID(LANDX,LANDY)
  640.    If LANDON=50 Then SEESAW[LANDX,LANDY,0]
  641.    If LANDON=51 Then SEESAW[LANDX-1,LANDY,1]
  642.    If LAND Then PASS=1 : If LANDON=16 or LANDON=24 Then Sam Play %1100,6,1500 Else Sam Play %1100,7,10000 Else If(GRID(X,Y)=18 or GRID(X,Y)=17) and LANDON=0 Then Sam Play %111,5,15000 Else Sam Play %100,5,12000+Rnd(8000)
  643.    If LANDON=8 or LANDON=15 or LANDON=19 Then TELEPORT[LANDX,LANDY,1]
  644.    If LANDON=25 Then ARROW[LANDX,LANDY,1]
  645.    If LANDON=16 or LANDON=24 Then SLIP[LANDX,LANDY,1]
  646.    If LANDON=11 Then BOMB
  647.    If LANDON=50 Then If _BOB(LANDX+1,LANDY) Then Inc LANDX : Pop Proc Else PASS=0
  648.    If LANDON=51 Then If _BOB(LANDX-1,LANDY) Then Dec LANDX : Pop Proc Else PASS=0
  649.    If LANDON=9
  650.       Wait 2 : Sam Play %1000,6,1200 : Bob MAN,,,40
  651.       Wait 2 : Sam Play %100,6,1300 : Bob MAN,,,41
  652.       Wait 2 : Sam Play %10,6,1400 : Bob Off MAN
  653.       _BOB(LANDX,LANDY)=0 : Dec IN : SHO_FIGURES
  654.       If IN>1
  655.          PLACE : LANDX=SX : LANDY=SY : PASS=0
  656.       End If 
  657.    End If 
  658. End Proc
  659. Procedure FACE[MAN,DREC]
  660. '
  661. ' Simple turn around and face a DIRECTION. These inportant procedures
  662. ' took days to write but once there done they make the whole thing work. 
  663. ' The more flexable the procedures are the more you can do with your 
  664. ' programme. Some new ideas can be put into the game without much work.  
  665. '  
  666.    OLD=DREC(MAN)
  667.    NEW=DREC
  668.    If OLD=NEW Then Goto OK
  669.    If OLD>0 Then Repeat : Add OLD,-1,0 To 3 : Add NEW,-1,0 To 3 : Until OLD=0
  670.    If NEW=3 Then SPIN=-1 Else SPIN=1
  671.    '
  672.    NEW=DREC(MAN)*2
  673.    Repeat 
  674.       Add NEW,SPIN,0 To 7
  675.       Bob MAN,,,Peek(Start(13)+162+NEW) : Rem temp Wait 3
  676.    Until NEW=DREC*2
  677.    '
  678.    OK:
  679.    Bob MAN,,,Peek(Start(13)+162+NEW)
  680.    DREC(MAN)=DREC
  681. End Proc
  682. Procedure MOVE[MAN,MX,MY,DREC]
  683. '
  684. ' This procedure is for moving them out at the start!
  685. '
  686.    If DREC(MAN)=DREC Then Goto LAA
  687.    Anim Off 15
  688.    If DREC(MAN)>-1 Then FACE[MAN,DREC]
  689.    Anim 15,"("+Str$(5+DREC*9)+",3)("+Str$(6+DREC*9)+",7)("+Str$(5+DREC*9)+",3)("+Str$(1+DREC*9)+",2)("+Str$(7+DREC*9)+",3)("+Str$(8+DREC*9)+",7)("+Str$(7+DREC*9)+",3)("+Str$(1+DREC*9)+",2)L"
  690.    Anim On 15
  691.    DREC(MAN)=DREC
  692.    LAA:
  693.    C=0
  694.    For A=0 To 14 Step 2
  695.       Bob MAN,X Bob(MAN)+MX,Y Bob(MAN)+MY,
  696.       Bob MAN,X Bob(MAN)+MX,Y Bob(MAN)+MY, : Wait Vbl 
  697.       If C<>6 Then If I Bob(MAN)=6+DREC*9 Then CHAN : Sam Play CHAN,5,14000 : C=6
  698.       If C<>8 Then If I Bob(MAN)=8+DREC*9 Then CHAN : Sam Play CHAN,5,18000 : C=8
  699.    Next A
  700. End Proc
  701. Procedure CANMOVE[XM,YM,BEEP]
  702. '
  703. ' sometimes a peg-it cant move in any direction at all! this is were   
  704. ' we find out. You see it just does four Folows[] and if none return 
  705. ' a PASS you can't move it!
  706. '
  707.    OK=0
  708.    FOLOW[XM,YM,0,-1,0]
  709.    If PASS=0
  710.       FOLOW[XM,YM,1,0,1]
  711.       If PASS=0
  712.          FOLOW[XM,YM,0,1,2]
  713.          If PASS=0
  714.             FOLOW[XM,YM,-1,0,3]
  715.          End If 
  716.       End If 
  717.    End If 
  718.    If PASS Then Inc OK : Pop Proc
  719.    If BEEP Then Sam Play %11,5,25000 : Repeat : Until Mouse Key=0
  720. End Proc
  721. Procedure TELEPORT[MX,MY,TELE]
  722. '
  723. ' once a teleport has been landed on just find the matching one
  724. ' and move him!
  725. '
  726.    PASS=0
  727.    For TX=0 To 8
  728.       For TY=0 To 8
  729.          If GRID(TX,TY)=GRID(MX,MY) Then If TX<>MX or TY<>MY Then If TBOB(TX,TY)=0 Then LANDX=TX : LANDY=TY : PASS=1 : TX=9 : TY=9 : Exit 
  730.       Next TY
  731.    Next TX
  732.    '
  733.    If TELE=0 Then Pop Proc
  734.    '
  735.    _BOB=_BOB(MX,MY)
  736.    SAM=0
  737.    For A=1 To 45
  738.       Bob _BOB,118+MX*16,35+MY*16, : Sam Play %1,1,22000-SAM : Sam Play %10,1,3000+SAM : Add SAM,220 : Wait Vbl 
  739.       Bob _BOB,118+LANDX*16,35+LANDY*16, : Sam Play %1,1,21500-SAM : Sam Play %10,1,3500+SAM : Add SAM,220 : Wait Vbl 
  740.    Next A
  741.    Sam Play %1,1,3500+SAM
  742.    Wait 3
  743.    Sam Play %10,1,3000+SAM
  744.    Swap _BOB(MX,MY),_BOB(LANDX,LANDY)
  745.    Timer=0
  746.    PASS=0
  747. End Proc
  748. Procedure ARROW[MX,MY,CAN]
  749. '
  750. ' Shift him over mate! 
  751. '
  752.    PASS=0
  753.    TX=MX-1 : TY=MY
  754.    If TBOB(TX,TY)=0 Then LANDX=TX : LANDY=TY : PASS=1
  755.    '
  756.    If CAN=0 Then Pop Proc
  757.    '
  758.    Bob _BOB(MX,MY),118+LANDX*16,35+LANDY*16,
  759.    Sam Play %1,6,5000 : Sam Play %10,7,2000
  760.    Swap _BOB(MX,MY),_BOB(LANDX,LANDY)
  761.    Timer=0
  762.    PASS=0
  763. End Proc
  764. Procedure SLIP[MX,MY,CAN]
  765. '
  766. ' Similar to teleports except you go back to a jump! 
  767. '
  768.    For TX=0 To 8
  769.       For TY=0 To 8
  770.          If GRID(TX,TY)=GRID(MX,MY) Then If TX<>MX or TY<>MY Then LANDX=TX : LANDY=TY : TX=9 : TY=9 : Exit 
  771.       Next TY
  772.    Next TX
  773.    '
  774.    If CAN=0 Then Pop Proc
  775.    '
  776.    _BOB=_BOB(MX,MY)
  777.    Bob _BOB,118+LANDX*16,35+LANDY*16,
  778.    Swap _BOB(MX,MY),_BOB(LANDX,LANDY)
  779.    Timer=0
  780. End Proc
  781. Procedure BOMB
  782. '
  783. ' when a button is pressed blow up all the Peg-Its that are standing on bombs! 
  784. '
  785.    PASS=0
  786.    For A=40 To 43
  787.       For TX=0 To 8
  788.          For TY=0 To 8
  789.             If GRID(TX,TY)=12
  790.                If _BOB(TX,TY)
  791.                   If A<43
  792.                      Bob _BOB(TX,TY),,,A
  793.                      CHAN : Sam Play CHAN,8,9000+Rnd(2000)
  794.                   Else 
  795.                      Bob Off _BOB(TX,TY) : _BOB(TX,TY)=0
  796.                      Dec IN : SHO_FIGURES
  797.                   End If 
  798.                   Wait 1
  799.                End If 
  800.             End If 
  801.          Next TY
  802.       Next TX
  803.    Next A
  804. End Proc
  805. Procedure SHO_FIGURES
  806. '
  807. ' Every 250 vbl's decreace the time! and display any other changes!
  808. '
  809.    If Timer>250 Then Dec TIME : Timer=0
  810.    Screen 1
  811.    If TIME<>LASTTIME
  812.       XXX=(4-Len(Str$(TIME)))*5
  813.       Cls 10 : _TEX[XXX,15,Str$(TIME)]
  814.       Screen Copy 1,0,0,38,18 To Logic(0),272,61
  815.       Screen Copy 1,0,0,38,18 To Physic(0),272,61
  816.       If LASTTIME>-1
  817.          Sam Play %1,4,18000+TIME*100
  818.          If TIME<11
  819.             Wait 3 : Sam Play %10,4,12000+TIME*200
  820.             If TIME<6
  821.                Wait 3 : Sam Play %100,4,6000+TIME*400
  822.                If TIME=0
  823.                   Wait 3 : Sam Play %1000,4,3000 : Wait 10
  824.                End If 
  825.             End If 
  826.          End If 
  827.       End If 
  828.    End If 
  829.    '
  830.    If JUMPS<>LASTJUMPS
  831.       XXX=(4-Len(Str$(JUMPS)))*5
  832.       Cls 10 : _TEX[XXX,17,Str$(JUMPS)]
  833.       Screen Copy 1,0,0,38,19 To Logic(0),272,135
  834.       Screen Copy 1,0,0,38,19 To Physic(0),272,135
  835.    End If 
  836.    '
  837.    If IN<>LASTIN
  838.       If IN>9
  839.          XXX=0
  840.       Else 
  841.          XXX=5
  842.       End If 
  843.       Cls 10 : _TEX[XXX,17,Str$(IN)]
  844.       Screen Copy 1,0,0,31,19 To Logic(0),32,131
  845.       Screen Copy 1,0,0,31,19 To Physic(0),32,131
  846.    End If 
  847.    '
  848.    LASTTIME=TIME
  849.    LASTJUMPS=JUMPS
  850.    LASTIN=IN
  851.    '
  852.    Screen 0
  853. End Proc
  854. Procedure PLACE
  855. '
  856. ' when the game starts it will select a random peg-it
  857. ' for you to start with! 
  858. '
  859.    Do 
  860.       TX=Rnd(8) : TY=Rnd(8)
  861.       If _BOB(TX,TY) Then CANMOVE[TX,TY,0] : If OK Then SX=TX : SY=TY : Exit 
  862.    Loop 
  863. End Proc
  864. Procedure OUTA
  865. '
  866. ' out a time/jumps matey!
  867. '
  868.    Fade 3
  869.    If TIME
  870.       For A=50 To 4 Step -1 : Wait 2 : Sam Play CHAN,6,1000+A*500 : CHAN : Next A
  871.    Else 
  872.       For A=1 To 30 : Wait 4 : Sam Play CHAN,4,15000-A*40 : CHAN : Next A
  873.    End If 
  874.    If Mouse Key Then Pop Proc
  875.    FRESHSCREEN[0]
  876.    Paste Bob 154,28,47
  877.    _TEX[138,70,"sorry"]
  878.    If TIME Then _TEX[110,90,"out of jumps"] Else _TEX[115,90,"out of time"]
  879.    Paste Bob 154,98,47
  880.    _TEX[98,140,"code is ."+CODE$+"."]
  881.    Paste Bob 154,148,47
  882.    UNTMOUSE
  883. End Proc
  884. Procedure FINESHED
  885. '
  886. ' Well done!!!!!!! 
  887. '
  888.    Sprite Off 8
  889.    Wait 40
  890.    Inc LEVEL
  891.    If LEVEL>50 Then Pop Proc
  892.    If IN=0 Then Goto SKIP
  893.    For X=0 To 8
  894.       For Y=0 To 8
  895.          MAN=_BOB(X,Y)
  896.          If MAN>0
  897.             Bob MAN,,,40 : Wait 7
  898.             Bob MAN,,,41 : Wait 7
  899.             Dec IN : SHO_FIGURES
  900.             Wait 10
  901.             Sam Play %1100,2,10000 : Bob MAN,,,42 : Wait 3
  902.             Sam Play %11,2,20000 : Bob Off MAN
  903.          End If 
  904.       Next Y
  905.    Next X
  906.    SKIP:
  907.    Wait 10
  908.    Fade 3
  909.    For A=50 To 1 Step -5
  910.       Volume %1111,A
  911.       Sam Play %1100,2,10000
  912.       Wait 2
  913.       Sam Play %11,2,20000
  914.       Wait 10
  915.    Next A
  916.    Volume %1111,63
  917.    '
  918.    FRESHSCREEN[0]
  919.    LEVEL
  920.    _TEX[113,46,"well done !"]
  921.    _TEX[98,64,"level complete"]
  922.    Paste Bob 151,70,47
  923.    _TEX[72,110,"get ready for level"+Str$(LEVEL)]
  924.    MES[LEVEL$] : _TEX[MES,128,LEVEL$]
  925.    Paste Bob 151,134,47
  926.    _TEX[95,174,"code is ."+CODE$+"."]
  927.    UNTMOUSE
  928. End Proc
  929. Procedure UNTMOUSE
  930. '
  931. ' wait for mouse before starting next screen!
  932. '
  933.    Paste Bob 140,183,46
  934.    Double Buffer 
  935.    Screen Show 0
  936.    For A=2 To 7
  937.       If A=2 Then Bob A,153,7,38 Else Bob A,153,10,47
  938.       Channel A To Bob A
  939.       Move X A,"(1,7,3)(1,6,6)(1,5,5)(1,4,5)(1,3,5)(1,2,5)(1,1,6)(1,0,5)(1,-1,6)(1,-2,5)(1,-3,5)(1,-4,5)(1,-5,5)(1,-6,6)(1,-7,6)(1,-6,6)(1,-5,5)(1,-4,5)(1,-3,5)(1,-2,5)(1,-1,6)(1,0,5)(1,1,6)(1,2,5)(1,3,5)(1,4,5)(1,5,5)(1,6,6)(1,7,3)L"
  940.       Move Y A,"(1,0,5)(1,1,5)(1,2,5)(1,3,5)(1,4,5)(1,5,4)(1,6,4)(1,5,4)(1,4,4)(1,3,5)(1,2,5)(1,1,5)(1,0,5)(1,-1,5)(1,-2,5)(1,-3,5)(1,-4,5)(1,-5,4)(1,-6,4)(1,-5,4)(1,-4,4)(1,-3,5)(1,-2,5)(1,-1,5)(1,0,5)L"
  941.       Move On A
  942.       Wait A*2
  943.    Next A
  944.    Fade 10 To 1
  945.    Shift Down 2,27,29,1
  946.    Timer=0 : T=0
  947.    Repeat 
  948.       If Timer>13 Then If T=0 Then Sam Play %10,6,20000 : Inc T
  949.       If Timer>26 Then Sam Play %1,5,15000 : Timer=0 : Dec T
  950.       If Key State(69) Then Inc _ENDIT : Exit 
  951.    Until Mouse Key
  952.    Fade 3
  953.    BLOOP
  954.    Wait 15
  955. End Proc
  956. Procedure BLOOP
  957. '
  958. ' Have a guess 
  959. '
  960.    Sam Play %1,1,10000 : Wait 3
  961.    Sam Play %10,2,10000 : Wait 3
  962.    Sam Play %100,1,12000 : Wait 3
  963.    Sam Play %1000,2,5000
  964. End Proc
  965. '                                Misc-Procs
  966. Procedure SEESAW[MX,MY,STATE]
  967. '
  968. ' move the seesaw down 
  969. '
  970.    For A=0 To 4
  971.       If SPRINGS(A,0)=MX and SPRINGS(A,1)=MY and SPRINGS(A,2)<>STATE
  972.          Bob 5+A,,,44
  973.          Wait 4
  974.          Bob 5+A,,,43+STATE*2
  975.          SPRINGS(A,2)=STATE
  976.       End If 
  977.    Next A
  978. End Proc
  979. Procedure JINGLE
  980. '
  981. ' start screen jingle
  982. '
  983.    Wait 23
  984.    For A=1 To 5
  985.       Sam Play %1,3,6000-A*1000
  986.       Wait 13
  987.    Next A
  988.    Wait 15
  989.    Sam Play %11,4,12000
  990.    Wait 10
  991.    Sam Play %11,4,12000
  992. End Proc
  993. Procedure LEVELCODE[L]
  994. '
  995. ' read level codes from data bank 10 
  996. '
  997.    CODE$=""
  998.    For A=0 To 4
  999.       B=Peek(Start(10)+(L-1)*100+9+A*10)
  1000.       If B=0 Then B$=" " Else B$=Chr$(B)
  1001.       CODE$=CODE$+B$
  1002.    Next A
  1003. End Proc
  1004. Procedure CHAN
  1005. '
  1006. ' I usualy play a sample through channal no chan which is 1 2 4 8  
  1007. ' then cycle through to next channal!
  1008. '
  1009.    CHAN=CHAN*2
  1010.    If CHAN>8 Then CHAN=1
  1011. '
  1012. End Proc
  1013. Procedure TASK[Z]
  1014.    '
  1015. ' misc. procedure, depends on value of z 
  1016. '
  1017.    For XC=0 To 8
  1018.       For YC=0 To 8
  1019.          If Z=0
  1020.             TBOB(XC,YC)=_BOB(XC,YC)
  1021.          Else 
  1022.             If Z=1
  1023.                _BOB(XC,YC)=0
  1024.             Else 
  1025.                If Z=2
  1026.                   GRID(XC,YC)=Peek(Start(10)+LEVEL*100+XC+YC*10)
  1027.                End If 
  1028.             End If 
  1029.          End If 
  1030.       Next YC
  1031.    Next XC
  1032. End Proc